package pack.controls;

import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.Renderer;
import com.jme.scene.Node;
import com.jme.scene.Text;
import com.jme.scene.Spatial.LightCombineMode;
import com.jme.scene.state.LightState;
import com.jme.system.DisplaySystem;

public class Crosshair 
{
    private DisplaySystem display = DisplaySystem.getDisplaySystem();

    private float screenHeight;
    private float screenWidth;
    
    private Node plusNode = null;
    private Text plusText = null;

    private Node crossNode = null;
    
    public Crosshair(final float width, final float heigth)
    {
        screenHeight = heigth;
        screenWidth  = width;
        
        crossNode = new Node("Crosshair");
        
        paint();

        LightState ls = display.getRenderer().createLightState();
        ls.setEnabled(false);
        crossNode.setLightCombineMode(LightCombineMode.Replace);
        crossNode.setRenderState(ls);

        crossNode.setRenderQueueMode(Renderer.QUEUE_ORTHO);
        crossNode.updateRenderState();        

    }
    
    public void paint()
    {    	
        plusNode = new Node("+ Node");

        plusText = Text.createDefaultTextLabel("fps", "+");
        plusText.setLocalScale(1.5f);
        plusText.setLocalTranslation(new Vector3f(screenWidth / 2f - 8f,
				screenHeight / 2f - 8f, 0));

        plusNode.attachChild(plusText);
        crossNode.attachChild(plusNode);
		
/*        *//*
		Text cross = new Text("Crosshairs", "+");
		cross.setTextColor(ColorRGBA.darkGray);
		// 8 is half the width of a font char
		*//*
		cross.setLocalTranslation(new Vector3f(screenWidth / 2f - 8f,
				screenHeight / 2f - 8f, 0));
		crossNode.attachChild(cross);    */	
    }
    
    public Node getCrossNode(){
    	return crossNode;
    }

}
